<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  const p = new Promise((resolve, reject)=>{
    try {
      console.log('即将执行A指令.....')
      // throw new Error-('执行失败')
      setTimeout(()=>{
        console.log('成功执行A指令,接下来请执行B命令')
        resolve('开始执行B命令')
      },2000)

    }catch (e){
      reject(e.message)
    }
  })

  .finally(()=>{

    console.log('开始执行特殊分支任务!')
    setTimeout(()=>{
      console.log('特殊任务玩完成！！！~~~')
    },2000)
    return new Promise((resolve, reject)=>{
      // reject('P2任务结束')
      resolve('我走我的和你们没关系')
      // throw new Error('error!!!')
      console.log('p2',p2)
    })
  })

  .then(value => {
    return new Promise((resolve, reject)=>{
      console.log(value)
      reject('恭喜完成所有指令！！！')
    })
  })
  .catch(reason => {
    setTimeout(()=>{
      console.log('B命令执行结束！！')
      console.log(reason)
    },2000)
  })
  // .then(value => {
  //   console.log(value)
  // })


</script>
</body>
</html>